﻿using NfsBLL;
using NfsModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ManagerWed.Controllers
{
    public class AuthorizationController : Controller
    {
        //
        // GET: /Authorization/
        public ActionResult Index()
        {
            AgencyBLL bll=new AgencyBLL();
             int id=Request["agency_id"]!=""?int.Parse(Request["agency_id"]):0;
             agency model = bll.GetModel(id);
            return View(model);
        }
        #region PC模糊查询
        public JsonResult query_authorization(int pageindex, int pagesize,int id)
        {
            try
            {
                AuthorizationBLL bll = new AuthorizationBLL();
                List<authorization> list = bll.GetAuthorizationBycondtion(pageindex, pagesize,id);
                object pagecount = bll.GetAuthorizationBycondtionCount(id);
                return Json(new { MessageCode = "0", AuthorizationList = list, Pagecount = (int.Parse(pagecount.ToString()) + pagesize - 1) / pagesize }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception)
            {

                return Json(new { MessageCode = "200" }, JsonRequestBehavior.AllowGet);

            }

        }
        #endregion
      
    }
}